package cn.maihe.elg.operation.centers.supports;

import cn.maihe.elg.operation.centers.epoint.dto.channel.EpointBaohanFileCompleteNoticeReqDTO;
import cn.maihe.elg.operation.centers.epoint.dto.channel.EpointDownloadPublickeyReqDTO;
import cn.maihe.elg.operation.centers.guogu.dto.GuoGuBaseRespDTO;
import cn.maihe.elg.operation.centers.guogu.dto.channel.req.GuoGuReductionNotifyReq;
import cn.maihe.elg.operation.centers.guogu.dto.channel.resp.GuoGuCusQueryRespData;
import cn.maihe.elg.operation.centers.supports.model.bo.ApplyGuaranteeRemoveBo;
import cn.maihe.elg.operation.centers.supports.model.bo.GuaranteeClaimSettlementResultBo;
import cn.maihe.elg.operation.centers.supports.model.bo.GuaranteeRevokeResultBo;
import cn.maihe.elg.operation.centers.supports.model.bo.InnerUploadBaohanFileBo;
import cn.maihe.elg.operation.centers.supports.model.bo.InvoiceResultBo;
import cn.maihe.elg.operation.centers.supports.model.bo.NoticeGuaranteeApplyResultBo;
import cn.maihe.elg.operation.centers.supports.model.bo.NoticePayResultBo;
import cn.maihe.elg.operation.centers.supports.model.bo.PushCenterGuaranteeBo;
import cn.maihe.elg.operation.centers.supports.model.bo.QueryGuaranteeInfoBo;
import cn.maihe.elg.operation.model.dto.InnerBaseResp;
import cn.maihe.elg.operation.model.enums.CenterNoEnum;

import java.nio.file.Path;

/**
 * @Description 请求|回调中心接口
 * @Author WJH
 * @Date 2021/05/26
 */
public interface CenterInterfaceService {

    /**
     * 中心枚举
     *
     * @return
     */
    CenterNoEnum getCenterNoEnum();

    /**
     * 电子保函支付结果通知
     * @param bo
     * @return
     */
    InnerBaseResp<NoticeGuaranteeApplyResultBo> noticePayResult(NoticePayResultBo bo);

    /**
     * 推送保函文件
     *
     * @param bo
     * @return
     */
    default InnerBaseResp<String> pushGuarantee(PushCenterGuaranteeBo bo) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 推送保函文件");
    }

    /**
     * 推送保函文件
     *
     * @param docxPath
     * @param acceptOrderNo
     * @return
     */
    default InnerBaseResp<String> pushGuarantee(Path docxPath, String acceptOrderNo) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 推送保函文件");
    }

    /**
     * 电子保函申请结果通知
     */
    default InnerBaseResp<NoticeGuaranteeApplyResultBo> noticeGuaranteeApplyResult(NoticeGuaranteeApplyResultBo bo) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 电子保函申请结果通知");
    }

    /**
     * 电子保函信息查询 ElectronicQuery
     */
    default InnerBaseResp<QueryGuaranteeInfoBo> queryGuaranteeInfo(QueryGuaranteeInfoBo bo) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 电子保函信息查询");
    }

    /**
     * 电子发票结果通知 InvoiceNotice
     */
    default InnerBaseResp<InvoiceResultBo> noticeInvoiceResult(InvoiceResultBo invoiceResultBo) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 电子发票结果通知");
    }

    /**
     * 解保申请 RlsGntAply [担保机构主动申请保函解除，达到银行释放担保公司冻结额度]
     * 此服务用于申请服务业务处理，保函系统提供接口，担保公司获取已开立保函且 未中标企业后，调用此接口申请解保接口申请解保
     */
    default InnerBaseResp<ApplyGuaranteeRemoveBo> applyGuaranteeRemove(ApplyGuaranteeRemoveBo bo) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 担保公司主动解保申请");
    }


    /**
     * 保函撤销|退保结果通知
     *
     * @param bo
     * @return
     */
    default InnerBaseResp<GuaranteeRevokeResultBo> noticeGuaranteeRevokeResult(GuaranteeRevokeResultBo bo) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 保函撤销|退保结果通知");
    }

    /**
     * 保函理赔申请结果通知
     *
     * @param bo
     * @return
     */
    default InnerBaseResp noticeGuaranteeClaimSettlementResult(GuaranteeClaimSettlementResultBo bo) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 保函理赔申请结果通知");
    }

    default InnerBaseResp downloadPublickey(String acceptOrderNo, EpointDownloadPublickeyReqDTO reqDTO) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 下载公钥");
    }

    default InnerBaseResp uploadBaohanFile(String acceptOrderNo, InnerUploadBaohanFileBo bo) {
        return InnerBaseResp.success(bo);
//        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 保函文件上传");
    }

    default InnerBaseResp baohanFileCompleteNotice(String acceptOrderNo, EpointBaohanFileCompleteNoticeReqDTO reqDTO) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 保函文件上传完成通知");
    }

    /**
     * 客户资料查询
     */
    default InnerBaseResp<GuoGuCusQueryRespData> queryCusInfo(String clientId, CenterNoEnum centerNoEnum, String applyno) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 客户信息查询");
    }

    /**
     * 开票结果通知
     */
    default <T> InnerBaseResp<T> invoiceResultNotify(String acceptOrderNo) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 开票结果通知");
    }

    /**
     * 还原结果推送
     */
    default InnerBaseResp<GuoGuBaseRespDTO> reductionResultNotify(String clientId, GuoGuReductionNotifyReq guoGuReductionNotifyReq,CenterNoEnum centerNoEnum) {
        throw new RuntimeException(getCenterNoEnum().getCenterName() + " 暂未实现 还原结果推送");
    }

    /**
     * 放弃申请通知
     */
    default <T> InnerBaseResp<T> giveupNotice(String acceptOrderNo) {
        return InnerBaseResp.success(null);
    }
}
